package com.example.imgrecognition.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.example.imgrecognition.Activity.TakePhotoActivity;
import com.example.imgrecognition.TestNetActivity;

/**
 * Created by Administrator on 2018/9/15.
 */
    public class UpdateRestartReceiver extends BroadcastReceiver {
        @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("android.intent.action.PACKAGE_REPLACED")){
            //Toast.makeText(context,"已升级到新版本",Toast.LENGTH_SHORT).show();

            Intent intent2 = new Intent(context, TakePhotoActivity.class);
            intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent2);

        }

    }
}
